﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.FieldNumber", ServerTypeId="{e32d2a19-d2a8-428c-b056-ea71ede547ce}")]
    public class FieldNumber : Field
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public FieldNumber(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "MinimumValue"))
                {
                    if (str == "MaximumValue")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["MaximumValue"] = reader.ReadDouble();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["MinimumValue"] = reader.ReadDouble();
            }
            return flag;
        }

        [Remote]
        public double MaximumValue
        {
            get
            {
                base.CheckUninitializedProperty("MaximumValue");
                return (double) base.ObjectData.Properties["MaximumValue"];
            }
            set
            {
                base.ObjectData.Properties["MaximumValue"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "MaximumValue", value));
                }
            }
        }

        [Remote]
        public double MinimumValue
        {
            get
            {
                base.CheckUninitializedProperty("MinimumValue");
                return (double) base.ObjectData.Properties["MinimumValue"];
            }
            set
            {
                base.ObjectData.Properties["MinimumValue"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "MinimumValue", value));
                }
            }
        }
    }
}

